using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace MediaWikiEngine.Domain
{
    public class CommandResult
    {
        Dictionary<string, object> _results = new Dictionary<string, object>();

        public object this[string name]
        {
            get { return _results[name]; }
            set { _results[name] = value; }
        }

        public CommandResult()
        {
        }

        public CommandResult(Hashtable results)
        {
            foreach (string key in results.Keys)
                this[key] = results[key];
        }

        protected bool Contains(string name)
        {
            return _results.ContainsKey(name);
        }

        public T GetData<T>(string name)
        {
            if (false == Contains(name))
                return default(T);

            return (T) this[name] ;
        }


    }
}
